import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    mode:'history',
    base:'/dist/',
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: resolve => require(['../components/view/Home.vue'], resolve),
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/dashboard',
                    component: resolve => require(['../views/Dashboard.vue'], resolve),
                    meta: { title: '系统管理' }
                },

                //系统管理
                {
                    path: '/systemUser',
                    component: resolve => require(['../views/SystemUser/systemUserList.vue'], resolve),
                    meta: { title: '系统用户列表' }
                },

                //抽奖管理
                {
                    path: '/LuckDrawList',
                    component: resolve => require(['../views/LuckDraw/luckDrawList.vue'], resolve),
                    meta: { title: '公共抽奖列表' }
                },
                {
                    path: '/addLuckDraw',
                    component: resolve => require(['../views/LuckDraw/addLuckDraw.vue'], resolve),
                    meta: { title: '添加考拉抽奖' }
                },
                {
                    name:'luckDrawDetails',
                    path: '/luckDrawDetails',
                    component: resolve => require(['../views/LuckDraw/luckDrawDetails.vue'], resolve),
                    meta: { title: '查看抽奖详情' }
                },
                {
                    name:'LuckDrawEdit',
                    path: '/LuckDrawEdit',
                    component: resolve => require(['../views/LuckDraw/luckDrawEdit.vue'], resolve),
                    meta: { title: '编辑抽奖' }
                },

                //用户管理
                {
                    path:'/User',
                    component: resolve => require(['../views/User/UserList.vue'], resolve),
                    meta: { title: '用户列表' }
                },
                {
                    name:'userDetails',
                    path:'/userDetails',
                    component: resolve => require(['../views/User/userDetails.vue'], resolve),
                    meta:{title:'用户列表详情'}
                },

                //推广管理
                {
                    path:'/Extension',
                    component: resolve => require(['../views/Extension/ExtensionList.vue'], resolve),
                    meta: { title: '推广列表' }
                },

                //留言列表
                {
                    path:'/Leaving',
                    component: resolve => require(['../views/Leaving/LeavingList.vue'], resolve),
                    meta: { title: '留言列表' }
                },
                 //投票列表
                 {
                    path:'/Vote',
                    component: resolve => require(['../views/Vote/voteList.vue'], resolve),
                    meta: { title: '投票列表' }
                },
                {
                    name:'voteDetails',
                    path:'/voteDetails',
                    component: resolve => require(['../views/Vote/voteDetails.vue'], resolve),
                    meta:{title:'投票详情'}
                },





                {
                    path: '/table',
                    component: resolve => require(['../views/BaseTable.vue'], resolve),
                    meta: { title: 'tab选项卡' }
                },
                {
                    path: '/tabs',
                    component: resolve => require(['../views/Tabs.vue'], resolve),
                    meta: { title: 'tab选项卡' }
                },
                {
                    path: '/form',
                    component: resolve => require(['../views/BaseForm.vue'], resolve),
                    meta: { title: '基本表单' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: resolve => require(['../views/VueEditor.vue'], resolve),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: resolve => require(['../views/Markdown.vue'], resolve),
                    meta: { title: 'markdown编辑器' }    
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: resolve => require(['../views/Upload.vue'], resolve),
                    meta: { title: '文件上传' }   
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: resolve => require(['../views/BaseCharts.vue'], resolve),
                    meta: { title: 'schart图表' }
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: resolve => require(['../views/DragList.vue'], resolve),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: resolve => require(['../views/Permission.vue'], resolve),
                    meta: { title: '权限测试', permission: true }
                }
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../views/Login.vue'], resolve)
        },
        {
            path: '/404',
            component: resolve => require(['../components/view/404.vue'], resolve)
        },
        {
            path: '/403',
            component: resolve => require(['../components/view/403.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
})
